/**
 * 
 */
package eu.news.data.hibernate.dao;
import java.util.List;

import org.hibernate.Query;

import eu.news.data.dao.SpecialDAO;
import eu.news.data.hibernate.pojo.HB_Special;
import eu.news.data.pojo.Special;


/**
 * @author WZZ
 *
 */
public class HB_SpecialDAO extends HibernateBaseDAO<Special> implements SpecialDAO {

	protected HB_SpecialDAO(){}
	
	public Special getByName(String name){
		String hql="from Special where name=:name";
		Query query=session.createQuery(hql);
		query.setString("name", name);
		return (Special) query.uniqueResult();
	}
	
	@SuppressWarnings("unchecked")
	public List<Special> getAll(int start,int size){
		String hql="from Special";
		Query query=session.createQuery(hql);
		query.setFirstResult(start);
		query.setMaxResults(size);
		return query.list();
	}

	@Override
	public Special newEntity() {
		return new HB_Special();
	}
}
